package com.helen.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.helen.ui.BaseFragment;

import java.util.List;


/**
 * Created by asus on 2017/8/30.
 */

public class OrderFragmentAdapter extends FragmentStatePagerAdapter {
    private String[] mTitles;
    private List<BaseFragment> mFragments;
    public OrderFragmentAdapter(FragmentManager fm, List<BaseFragment>mFragments, String[] titles) {
        super(fm);
        this.mTitles = titles;
        this.mFragments = mFragments;
    }

    @Override
    public int getCount() {
        return mTitles.length;
    }

    @Override
    public BaseFragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }

    public void reloadFragment(int position){
        mFragments.get(position).reloadData();
    }
}